package com.labichaoka.chaoka.utils;

import android.annotation.SuppressLint;

import com.kaopiz.kprogresshud.KProgressHUD;
import com.labichaoka.chaoka.base.MyApplication;

public class DialogUtils {
    @SuppressLint("StaticFieldLeak")
    static KProgressHUD hud=null;

    public static void showProgress(){
        if (hud==null){
            hud = KProgressHUD.create(MyApplication.getInstance().getApplicationContext())
                    .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
                    .setCancellable(true)
                    .setDimAmount(0.5f);
        }

        hud.show();
    }

    public static void hideProgress(){
        if (hud!=null&&hud.isShowing()){
            hud.dismiss();
            hud=null;
        }
    }
}
